﻿using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Text;
using JustinAngel.Neurons.Framework.Helpers;

namespace JustinAngel.UnitedNationsNews.Framework
{
    public class IsolatedStorageHelper : IIsolatedStorageHelper
    {
       private IsolatedStorageSettings Settings
        {
            get
            {
                try
                {
                    return IsolatedStorageSettings.ApplicationSettings;
                }
                catch
                {
                    return IsolatedStorageSettings.ApplicationSettings;
                }
            }
        }

        public void SetSetting(string key, object value)
        {
            Settings[key] = value;
            Settings.Save();
        }

        public object GetSetting(string key)
        {
            if (!Settings.Contains(key))
                return null;
            else
                return Settings[key];
        }
    }
}
